﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using IntoStationSystem.ViewModels;

namespace IntoStationSystem.Views
{
    /// <summary>
    /// ManualOperation.xaml 的交互逻辑
    /// </summary>
    public partial class ManualView : UserControl
    {
        ManualViewModel vm => Locator.Instance.ManualVM;
        public ManualView()
        {
            InitializeComponent();
            this.DataContext = vm;
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            vm.PageTurnCmd.Execute(1);
            Locator.Instance.Service.SetPageID(11);
        }

        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
        {
            Locator.Instance.Service.SetPageID(0);
        }

        private void Btn_Down(object sender, MouseButtonEventArgs e)
        {
            var para = (sender as Button).CommandParameter;
            vm.Set(Convert.ToInt32(para));
        }

        private void Btn_Up(object sender, MouseButtonEventArgs e)
        {
            var para = (sender as Button).CommandParameter;
            vm.Reset(Convert.ToInt32(para));
        }
    }
}
